package com.zoe.onelink.enhancer.scanner;

import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.boot.autoconfigure.AutoConfigurationPackages;

import java.util.Collection;
import java.util.Set;

/**
 * <p>标题: </p>
 * <p>描述: </p>
 * <p>版权: Copyright (c) 2022</p>
 * <p>公司: 智业软件股份有限公司</p>
 *
 * @version: 1.0
 * @author: ruansheng
 * @date: 2022-11-01
 */
@RequiredArgsConstructor
public abstract class AbstractClassScanner implements ClassScanner {

    private final BeanFactory beanFactory;

    protected abstract void doInvoke(Set<? extends Class<?>> classes);

    @Override
    public void invoke(Set<? extends Class<?>> classes) {
        this.doInvoke(classes);
    }

    @Override
    public Collection<String> baseScanPackages() {
        return AutoConfigurationPackages.get(this.beanFactory);
    }
}
